// ----------------------------------
// RSDK Project: Sonic 1/Sonic 2
// Script Description: Plane Sw L Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------

//-------Aliases-------//
private alias 42 : TYPE_PLANESWL


// Static Values

// Tables

event ObjectMain
	foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
		if object[currentPlayer].gravity == GRAVITY_GROUND
			BoxCollisionTest(C_TOUCH, object.entityPos, -12, object.value0, 12, object.value1, currentPlayer, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO, HITBOX_AUTO)
			if checkResult == 1
				if object[currentPlayer].speed > 0
					object[currentPlayer].collisionPlane = PATH_B
				else
					object[currentPlayer].collisionPlane = PATH_A
				end if
			end if
		end if
	next
end event


event ObjectStartup
	foreach (TypeName[Plane Sw L], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].value0 = object[arrayPos0].propertyValue
		object[arrayPos0].value0 <<= 3
		object[arrayPos0].value1 = object[arrayPos0].value0
		FlipSign(object[arrayPos0].value0)
		object[arrayPos0].value0 -= 8
		object[arrayPos0].value1 += 8
	next
end event

event RSDKDraw
	temp0 = object.value0
	while (temp0 < object.value1)
		temp1 = object.iypos
		temp1 += temp0;
		temp1 <<= 16
		DrawSpriteXY(0, object.xpos, temp1)
	loop
end event

event RSDKLoad
	LoadSpriteSheet("Global/Display.gif")
	SpriteFrame(-8, -8, 16, 16, 222, 239)
	
	foreach (TypeName[Plane Sw L], arrayPos0, ALL_ENTITIES)
		object[arrayPos0].value0 = object[arrayPos0].propertyValue
		object[arrayPos0].value0 <<= 3
		object[arrayPos0].value1 = object[arrayPos0].value0
		FlipSign(object[arrayPos0].value0)
		object[arrayPos0].value0 -= 8
		object[arrayPos0].value1 += 8
	next
end event
